/**
 * Created by joustany on 18/1/19.
 */
var yearId = $.urlGet().year,
    serveId = null
var redirect = JSON.parse(decodeURIComponent(JSON.parse(window.localStorage.user).redirect))
// console.log(year)
$(function () {
    "use strict"
    // console.log(yearId)
    // console.log($('.container').attr('data-id',yearId))
    $.ajax({
        url:configApi('/item/view'),
        data:{
            id:yearId,
            access_token:redirect.token,
        },
        dataType:"json",
        type:"get",
        success:function (res) {
           if(res.success){
               console.log(res)
               var data = res.data.item.details
               serveId = res.data.item.id
               console.log(data)
               $('.container').html(data)
           }else {
               layer.open({
                   content: res.message
                   ,skin: 'msg'
                   ,time: 2 //2秒后自动关闭
               });
           }
        },
        error:function () {
            layer.open({
                content: "服务器异常,请退出重试"
                ,skin: 'msg'
                ,time: 2 //2秒后自动关闭
            });
        }
    })

})
function cartHandler() {
    "use strict"
    var yearIds = new Array()
    yearIds.push(serveId)
    window.sessionStorage.yearId = yearIds
    window.location.href = './index.html'
}
